package com.blacksee.bluetoothpoker.network;

/**
 * This interface specifies what operations a message sender should be able to perform.
 * Message senders are only subject to network layer, generally this interface will be invoked
 * by the MessageInterface in order to delegate messages to the server/client.
 * 
 * @author plamKaTa
 */
interface IMessageSender {
	
	/**
	 * Both the client and the server should be able to broadcast a message.
	 * In case of the server/master - it should send the message to all it's slaves, 
	 * in case of the client/slave - it should send the message to the server and 
	 * the server should send the message to all.
	 * 
	 * There is no need to send the message to yourself - this will be performed in 
	 * the NetworkInterface.
	 * 
	 * @param message the message to be sent
	 */
	void broadcastMessage(String message) throws BlueNetException;
	
	/**
	 * We need to be able to send messages:
	 *   1. from client to server and 
	 *   2. from server to client only
	 * without broadcasting to all.
	 * 
	 * There is no need to send the message to yourself - this will be performed in 
	 * the NetworkInterface.
	 * 
	 * @param receiverId the id of the receiver (used in case of the server)
	 * @param message the message to be sent
	 */
	void sendMessage(int receiverId, String message) throws BlueNetException;
	
}
